//
//  RecommendDetailController.m
//  JZMCFM
//
//  Created by zhangxin.com on 15/11/3.
//  Copyright (c) 2015年 陈卓. All rights reserved.
//

#import "RecommendDetailController.h"

@interface RecommendDetailController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, strong)RecommendDetailView *recommendView;
@end

@implementation RecommendDetailController

-(void)loadView
{
    self.recommendView = [[RecommendDetailView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.view = self.recommendView;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = self.title11;
   // [[RecommendDetailHelper shareInstance]xiaobianTopRequestDataForReload];
    [[RecommendDetailHelper shareInstance]downLoadFinished:^{
        [self.recommendView.MainTableView reloadData];
    }];
    
    
    self.recommendView.MainTableView.delegate = self;
    self.recommendView.MainTableView.dataSource = self;
   
    
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [RecommendDetailHelper shareInstance].aoneArray.count;
//    NSLog(@"aoneArray.count=====%ld",(unsigned long)[RecommendDetailHelper shareInstance].aoneArray.count);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cell_id = @"flag";
    RecommendDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cell_id];
    if (cell == nil) {
        cell = [[RecommendDetailTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cell_id];

            RecommedTitleModel *model = [RecommendDetailHelper shareInstance].aoneArray[indexPath.row];
            NSLog(@"%@",model);
            
            [cell setdetailcellmodel:model];
//        }else {
//            RecommedTitleModel *model1 = [RecommendDetailHelper shareInstance].aoneArray[indexPath.row];
//            [cell setdetailcellforJINGBINGTINGDANmodel:model1];
//        }
       
       
    }
    return cell;
    
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 90;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   [tableView deselectRowAtIndexPath:indexPath animated:YES];
    RecommendDetailMoreViewController *vc = [[RecommendDetailMoreViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
    
}

@end
